package src.edu.wayne.cs.csc4110.hw6.implementations.userPanels;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import src.edu.wayne.cs.csc4110.hw6.implementations.stateMachine.StateMachine;
import src.edu.wayne.cs.csc4110.hw6.implementations.stateMachine.StateMachineFrame;
import src.edu.wayne.cs.csc4110.hw6.interfaces.State;



public class UserHomePanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1681547309611900119L;
	StateMachine stateMachine;
	
	public UserHomePanel(StateMachine stateMachine){
	this.stateMachine = stateMachine;

	//Create a panel
	this.setLayout(new BorderLayout(0, 150));
	this.setBackground(StateMachineFrame.getColor());
	this.setForeground(StateMachineFrame.getColor());
	this.add(new JLabel("This page needs some work"), BorderLayout.NORTH);
	
	
	//Put buttons on it
	JPanel buttonPanel = new JPanel();
	buttonPanel.setLayout(new GridLayout(1,0));
	buttonPanel.setBackground(StateMachineFrame.getColor());
	
	JButton jbtnAddUser = new JButton("Login another user");
	jbtnAddUser.addActionListener(
			new ActionListener() 
			{
				public void actionPerformed(ActionEvent e)
				{
					goToAddUserState();
				}
			}
		);
	
	this.add(buttonPanel, BorderLayout.CENTER);
	
	stateMachine.setDisplayPanel(this, "HomePanel");
	}

	private void goToAddUserState() {
		stateMachine.goToAddUserState();
	}

}
